package com.yunfangdata.mapper;

import com.yunfangdata.domain.Employee;
import com.yunfangdata.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);


    /**
     * 根据条件 查询出的员工数量
     * @param qo
     * @return
     */
    int queryForCount(QueryObject qo);

    /**
     * 根据条件查询出 相应的员工信息集合
     * @param qo
     * @return
     */
    List<Employee> queryForList(QueryObject qo);

    /**
     * 查询所有经理
     * @return
     */
    List<Employee> queryEmployeeByRoleManager();

    void changeState(Long id);

    void deleteEmpAndRoleRelation(Long empId);

    void saveEmpAndRoleRelation(@Param("empId")Long empId, @Param("roleId")Long roleId);

    Employee queryCurrentUserByEmpUsername(String uname);

    Employee queryCurrentUserByEmpUsernameAndPassword(@Param("un") String un, @Param("psw") String psw);

    int changePassword(@Param("username")String username, @Param("password")String password, @Param("newPassword")String newPassword);

    Employee queryPortraitByUsername(String username);
}